import React,{ FormEvent, useState } from 'react';
import * as auth from '../../auth-provider'
const LoginScreen = ()=>{
    const [list,setList] = useState()
    const handleSubmit = (event: FormEvent<HTMLFormElement>) =>{
        event.preventDefault();
        const username = (event.currentTarget.elements[0] as HTMLFormElement).value;
        const password = (event.currentTarget.elements[1] as HTMLFormElement).value;
        login({username,password})
    }

    const login = (param:{username:string,password:string})=>{
        auth.login(param)
    }
    return (
        <form onSubmit={handleSubmit}>
            <div>
                <label htmlFor='username'>用户名</label>
                <input id='usename'/>
            </div>
            <div>
                <label htmlFor='password'>密码</label>
                <input id='password'/>
            </div>
            <button type='submit'>提交</button>
        </form>
    )
}
export default LoginScreen